% regressors 

if (decomposition & equal_tech)
    
    X_m=[ones(N,1) married==0 zeros(N,1) zeros(N,1) zeros(N,1) zeros(N,1) ones(N,1)*8 zeros(N,1)];

    X_f=[ones(N,1) ones(N,1)*8 zeros(N,1) zeros(N,1) zeros(N,1)];
    X_f(married==0)=-inf;

    X_Y=[ones(N,1) married==0 zeros(N,1) zeros(N,1) zeros(N,1) zeros(N,1) ones(N,1)*8 zeros(N,1) ...
         zeros(N,1) zeros(N,1)];

    X_theta=[ones(N,1) married==0 zeros(N,1) zeros(N,1) zeros(N,1) zeros(N,1) ones(N,1)*8 zeros(N,1) ...
             zeros(N,1) zeros(N,1)];    
else
    
    X_m=[ones(N,1) married==0 type==2 type==3 edu4_m==3 edu4_m==4 age nkid_0_5];

    X_f=[ones(N,1) age nkid_0_5 edu4_f==3 edu4_f==4];
    X_f(married==0)=-inf;

    X_Y=[ones(N,1) married==0 type==2 type==3 edu4_m==3 edu4_m==4 age nkid_0_5 ...
         edu4_f==3 edu4_f==4];

    X_theta=[ones(N,1) married==0 type==2 type==3 edu4_m==3 edu4_m==4 age nkid_0_5 ...
             edu4_f==3 edu4_f==4];    

end

if (price_reduction & Cobb_Douglas)
    
    for i=1:N
        
        m=married(i)+1;
        e=edu_m(i);
        t=age(i);
        
        a_m(i,1)=share_model_age(m,e,t,1);
        a_f(i,1)=share_model_age(m,e,t,2);
        a_g(i,1)=share_model_age(m,e,t,3);
    end
    
    a_y=1-a_m-a_f-a_g;
    
else

    
    a_m=exp(X_m*phi_m)./(1+exp(X_m*phi_m)+exp(X_f*phi_f));
    a_f=exp(X_f*phi_f)./(1+exp(X_m*phi_m)+exp(X_f*phi_f));
    a_g=1./(1+exp(X_m*phi_m)+exp(X_f*phi_f));
    a_y=exp(X_Y*phi_Y)./(1+exp(X_Y*phi_Y));
    a_h=1-a_y;
    
end
